/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Customer",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Demo.IServices;
using VOL.Demo.IRepositories;

namespace VOL.Demo.Controllers
{
    public partial class CustomerController
    {
        private readonly ICustomerService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly ICustomerRepository _customerRepository;

        [ActivatorUtilitiesConstructor]
        public CustomerController(
            ICustomerService service,
            IHttpContextAccessor httpContextAccessor,
            ICustomerRepository customerRepository


        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
            _customerRepository = customerRepository;
        }
        [HttpGet, Route("updateSd")]
        public IActionResult UpdateSd(Guid customerid, int sd)
        {
            Customer customer = new Customer()
            {
                CustomerId = customerid,
                Sd = sd
            };
            _customerRepository.Update(customer, x => new { x.Sd }, true);
            return Content("修改成功");
        }
    }
}
